package com.druid.common;

import com.druid.entity.CeSecurityRole;
import com.druid.service.managementservice.ICeSecurityRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.util.List;

@Component
public class ConstantCache implements CommandLineRunner {

    @Autowired
    private ICeSecurityRoleService iCeSecurityRoleService;

    private static List<CeSecurityRole> securityRoleList;

    @Override
    public void run(String... args){
        securityRoleList = iCeSecurityRoleService.list();
    }

    public static List<CeSecurityRole> getSecurityRoleListCache(){
        return securityRoleList;
    }
}
